<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/views/include/inc.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>通用权限管理系统</title>
<link href="<%=contextPath%>/assets/login/css/login.css"
	rel="stylesheet" rev="stylesheet" type="text/css" media="all" />
<link href="<%=contextPath%>/assets/login/css/demo.css" rel="stylesheet"
	rev="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="<%=contextPath%>/js/jquery.js"></script>
<script type="text/javascript"
	src="<%=contextPath%>/assets/login/js/jquery.SuperSlide.js"></script>
<script type="text/javascript" src="<%=contextPath%>/js/jquery.form.js"></script>
<script>
	function validate(formData, jqForm, options) { //在这里对表单进行验证，如果不符合规则，将返回false来阻止表单提交，直到符合规则为止
		for (var i = 0; i < formData.length; i++) {
			if (!formData[i].value) {
				$(".error-box").html('用户名或密码不能为空!');
				return false;
			}
		}
		return true;
	}
	$(function() {
		$('#loginForm').submit(function() {
			$(this).ajaxSubmit({
				dataType : 'json',
				beforeSubmit : validate, //验证
				success : function(data) {
					if (data.success) {
						location.href = "<%=contextPath%>/sys/index";
					} else {
						$(".error-box").html(data.message);
						refreshCaptcha();
					}
				}
			});
			return false; //阻止表单默认提交
		});
	});
</script>
</head>
<body>
	<div class="header">
		<h1 class="headerLogo" style="margin: 20px;">
			<a title="后台管理系统" href=""><img alt="logo"
				src="<%=contextPath%>/images/logo.png" /></a>
		</h1>

		<div class="headerNav">
			<a target="_blank" href="http://www.taoyeshu.com/">开发团队</a> <a
				target="_blank" href="http://www.taoyeshu.com/">意见反馈</a> <a
				target="_blank" href="http://www.taoyeshu.com/">帮助</a>
		</div>
	</div>

	<div class="banner">

		<div class="login-aside">
			<div id="o-box-up"></div>
			<div id="o-box-down" style="table-layout: fixed;">
				<div class="error-box"></div>

				<form id="loginForm" class="registerform"
					action="<%=contextPath%>/login.json" method="post">
					<div class="fm-item">
						<label for="logonId" class="form-label">登陆名：</label> <input
							type="text" name="username" id="username" class="i-text" />

						<div class="ui-form-explain"></div>
					</div>

					<div class="fm-item">
						<label for="logonId" class="form-label">登陆密码：</label> <input
							type="password" name="password" id="password" class="i-text" />

						<div class="ui-form-explain"></div>
					</div>

					<div class="fm-item pos-r">
						<label for="logonId" class="form-label">验证码</label> <input
							type="text" name="captcha" id="yzm" class="i-text yzm" />

						<div class="ui-form-explain">
							<img id="captcha" onclick="javascript:refreshCaptcha();"
								src="<%=contextPath%>/getCaptcha" class="yzm-img" />
						</div>
					</div>

					<div class="fm-item">
						<label for="logonId" class="form-label"></label> <input
							type="submit" value="" tabindex="4" id="send-btn"
							class="btn-login" />

						<div class="ui-form-explain"></div>
					</div>
				</form>
			</div>
		</div>
		<div class="bd">
			<ul>
				<li
					style="background: url(<%=contextPath%>/assets/login/themes/theme-pic1.jpg) #CCE1F3 center 0 no-repeat;"></li>
				<li
					style="background: url(<%=contextPath%>/assets/login/themes/theme-pic2.jpg) #BCE0FF center 0 no-repeat;"></li>
			</ul>
		</div>
		<div class="hd">
			<ul></ul>
		</div>
	</div>
	<script type="text/javascript">
		jQuery(".banner").slide({
			titCell : ".hd ul",
			mainCell : ".bd ul",
			effect : "fold",
			autoPlay : true,
			autoPage : true,
			trigger : "click"
		});
		function refreshCaptcha() {
			$("#captcha").attr("src",
					'<%=contextPath%>/getCaptcha?t=' + Math.random());
		}
	</script>
</body>
</html>